file_name_a = 'pride_and_prejudice.txt'
file_name_b = 'the_adventures_of_Sherlock_Holmes.txt'
file_names = [file_name_a, file_name_b, 'file.txt']
for file_name in file_names:
    try:
        with open(file_name, encoding='utf-8') as file_obj:
            content = file_obj.read()
    except FileNotFoundError:
        print('File ' + file_name + ' does not exist.')
    else:
        times = content.count('the')
        print('The times of "the" ' + 'in ' + file_name + ': ' + str(times))
        content = content.lower()
        times = content.count('the')
        print('The times of "the" or "The" ' +
              'in ' + file_name + ': ' + str(times))
